The formation of the planets